<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/7/8
 * Time: 10:01
 */
namespace app\admin\model;

use think\Model;

class Client extends Model
{
    protected $table = 'sw_client';
    //自动写入时间戳
    protected $autoWriteTimestamp = false;
    // 定义类型转换
    /*protected $type = [
        'birthday'    => 'timestamp:Y/m/d',
    ];*/
    // 定义自动完成的属性
    protected $insert             = [
        'status'=>1,
        'enc_appkey'
    ];

    protected $field = [];
    // enc_appkey属性修改器
    protected function setEncAppKeyAttr($value,$data)
    {
        return md5($data['appkey']);
    }
    // status属性读取器
    protected function getStatusAttr($value)
    {
        $status = [0 => '禁用', 1 => '正常',];
        return $status[$value];
    }
    // appkey属性读取器
    protected function getAppKeyAttr($value)
    {
        return md5($value);
    }


}